package work.mediway.common.exception;

import lombok.Getter;
import lombok.Setter;
import work.mediway.common.domain.enums.CodeAndMsgEnum;

/**
 * 自定义异常
 *
 * @author zhongyj <1126834403@qq.com><br/>
 * @date 2019/11/7
 */
@Getter
@Setter
public class GlobalDataException extends RuntimeException {

    /**
     * 异常信息
     */
    private String message;

    /**
     * 异常状态码
     */
    private String code;

    public GlobalDataException(String msg) {
        super(msg);
        this.message = msg;
    }

    public GlobalDataException(String msg, String code) {
        super(msg);
        this.message = msg;
        this.code = code;
    }

    public GlobalDataException(CodeAndMsgEnum bizExceptionEnum) {
        super(bizExceptionEnum.getMessage());
        this.code = Integer.toString(bizExceptionEnum.getCode());
        this.message = bizExceptionEnum.getMessage();
    }

}













